﻿package mortal.game.view.copy.escort
{
    import Message.Public.*;
    import extend.language.*;
    import flash.events.*;
    import mortal.game.cache.*;
    import mortal.game.events.*;
    import mortal.game.manager.*;
    import mortal.game.manager.msgTip.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.*;
    import mortal.game.view.activeTime.*;
    import mortal.game.view.common.*;
    import mortal.mvc.core.*;

    public class EscortCopyIcon extends ActionBaseIcon
    {
        private static var _instance:EscortCopyIcon;

        public function EscortCopyIcon(param1:String)
        {
            super(param1);
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            return;
        }// end function

        override protected function clickHandler(event:MouseEvent) : void
        {
            if (Cache.instance.role.entityInfo.level < GameDefConfig.instance.getSystemOpenLevel(52))
            {
                MsgManager.showRollTipsMsg(GameDefConfig.instance.getSystemOpenLevel(52) + Language.getString(35185), MsgRollTipsType.msgRollTips3);
            }
            else if (!ActiveTimeUtil.isInDoubleTimeByType(EActiveType._EActiveTypeEscort))
            {
                MsgManager.showRollTipsMsg(Language.getStringByParam(35186, currentTimeStr), MsgRollTipsType.msgRollTips3);
            }
            else
            {
                Cache.instance.copy.escort.isInDoubleEscort = true;
                Dispatcher.dispatchEvent(new DataEvent(EventName.EscortCopyOpenSelectTaskWindow));
            }
            return;
        }// end function

        public static function get instance() : EscortCopyIcon
        {
            if (!_instance)
            {
                _instance = new EscortCopyIcon(ResFileConst.EscortIcon);
            }
            return _instance;
        }// end function

        public static function get isViewShow() : Boolean
        {
            return _instance && !_instance.isHide;
        }// end function

        public static function get hasInstance() : Boolean
        {
            return _instance != null;
        }// end function

    }
}
